function matrix=roi_lin2mat(rois)
% matrix=roi_lin2mat(rois)
% 
% Converts a linear index ROIs to the Nx256x256 matrix compatible with MAXISERIES.
% The input can be either a single ROI vector or a cell structure.
%
% See also: roi_mat2lin
%
% 2012 Ari-Pekka Honkanen

if (iscell(rois))

	for ii=1:length(rois)
		matrix(ii,:,:)=zeros(256,256);
		matrix(ii,rois{ii})=1;
	end
	matrix=uint8(matrix);
else
	matrix(1,:,:)=zeros(256,256);
	matrix(1,rois)=1;
	matrix=uint8(matrix);
end